package com.niit.drugsmanager.service.Impl;

import com.niit.drugsmanager.entity.RealNameAuth;
import com.niit.drugsmanager.repository.RealNameAuthRepository;
import com.niit.drugsmanager.service.RealNameService;
import jakarta.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Transactional
public class RealNameServiceImpl implements RealNameService {
    @Autowired
    private RealNameAuthRepository authRepository;

    @Override
    public RealNameAuth saveRealNameAuth(RealNameAuth realNameAuth) {
        return authRepository.save(realNameAuth);
    }

    @Override
    public void deleteRealNameAuth(RealNameAuth realNameAuth) {
        authRepository.delete(realNameAuth);
    }

    @Override
    public RealNameAuth getRealNameAuthByUserId(Long uid) {
        return authRepository.findByUserId(uid);
    }

    @Override
    public List<RealNameAuth> findAllRealNameAuth() {
        return authRepository.findAll();
    }
}
